##
## This file is part of the django-oidauth project.
##
## Copyright (C) 2009 Filippo Santovito <http://mementomori.myvidoop.com/>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License version 3 as
## published by the Free Software Foundation;
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
##

from django.db import models
from django.contrib.auth.models import User

GENDER = (
    ('M', 'Male'),
    ('F', 'Female'), 
    )

    
class OpenID(models.Model):
    """
    user profile extension.
    Every OpenID url represent a single person.

    fields from:
    http://openid.net/specs/openid-simple-registration-extension-1_0.html#response_format

    TODO:
    look up the openid specification for better max_lenght in CharFields

    """

    user = models.ForeignKey(User, unique='True')
    url = models.CharField(max_length = 50)
    nickname = models.CharField(max_length = 50)
    fullname = models.CharField(max_length = 50, blank = True)
    dob = models.DateField(blank = True, null = True)
    gender = models.CharField(max_length=1, choices = GENDER, blank = True)
    postcode = models.CharField(max_length = 10, blank = True)
    country = models.CharField(max_length = 20, blank = True)
    language = models.CharField(max_length = 20, blank = True)
    timezone = models.CharField(max_length = 20, blank = True)

    def __unicode__(self):
        return self.url

